package com.dswz.service.impl;

import com.dswz.service.UploadService;
import java.io.File;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service("uploadService")
public class UploadServiceImpl implements UploadService {
	public String uploadFile(String folder, String fileName, MultipartFile file) throws Exception {
		File f = new File("/mnt/zyzf/install/nginx/html/image/" + folder + "/");
		if (!f.exists()) {
			f.mkdirs();
		}

		file.transferTo(new File("/mnt/zyzf/install/nginx/html/image/" + folder + "/" + fileName));
		return "http://img.shanxinw.com/image/" + folder + "/" + fileName;
	}
}
